home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / wwbbs31_source.lha / WWBBS / UserMaintSrc / usermaint.c < prev   
C/C++ Source or Header  |  1994-10-15  |  2KB  |  87 lines

  1. #include <exec/types.h>
  2. #include <exec/exec.h>
  3. #include <libraries/wwbbs.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7.  
  8. #include <proto/exec.h>
  9. #include <proto/dos.h>
  10. #include <proto/wwbbs.h>
  11.  
  12. #include "usermaint_rev.h"
  13.  
  14. char *ver=VERSTAG;
  15.  
  16. struct Library *WorldWideBase;
  17.  
  18. void close_all(void);
  19.  
  20. struct BufferNode {
  21.     struct Node bn_Node;
  22.     BYTE bn_Buffer[33];
  23. };
  24.  
  25. void main()
  26.     {
  27.         if(!(WorldWideBase=OpenLibrary("wwbbs.library",0)))
  28.             close_all();
  29.         {
  30.             BOOL savelist=FALSE;
  31.             struct DateStamp CurrentDate;
  32.             DateStamp(&CurrentDate);
  33.             {
  34.                 BOOL onlyrealnames=FALSE;
  35.                 struct List BufferList;
  36.                 NewList(&BufferList);
  37.                 GetConfigTags(CFGTAG_Name,"System",SYSTAG_OnlyRealNames,&onlyrealnames,TAG_END);
  38.                 {
  39.                     ULONG next=0;
  40.                     BYTE *username=NULL,*realname=NULL;
  41.                     ULONG days=0;
  42.                     struct DateStamp laston={0};
  43.                     while(next=GetUserTags(USRTAG_UserName,&username,USRTAG_RealName,&realname,USRTAG_Next,next,
  44.                             USRTAG_Days,&days,USRTAG_LastOn,&laston,
  45.                             TAG_END))
  46.                         {
  47.                             if(days && laston.ds_Days)
  48.                                 {
  49.                                     if(laston.ds_Days+days<CurrentDate.ds_Days)
  50.                                         {
  51.                                             struct BufferNode *node;
  52.                                             if(node=AllocVec(sizeof(struct BufferNode),MEMF_CLEAR))
  53.                                                 {
  54.                                                     strcpy(node->bn_Buffer,(onlyrealnames) ? realname : username);
  55.                                                     node->bn_Node.ln_Name=node->bn_Buffer;
  56.                                                     AddTail(&BufferList,(struct Node *) node);
  57.                                                 }
  58.                                         }
  59.                                 }
  60.                         }
  61.                 }
  62.                 {
  63.                     struct BufferNode *node;
  64.                     while(node=(struct BufferNode *) RemHead(&BufferList))
  65.                         {
  66.                             {
  67.                                 char s[64];
  68.                                 sprintf(s,"Deleted user `%s'.",node->bn_Buffer);
  69.                                 LogEntry(NULL,"User Maintenance",s);
  70.                             }
  71.                             RemUserTags(USRTAG_Name,node->bn_Buffer,TAG_END);
  72.                             FreeVec(node);
  73.                         }
  74.                 }
  75.             }
  76.             if(savelist)
  77.                 SetUserTags(USRTAG_ForceSave,TRUE,TAG_END);
  78.         }
  79.         close_all();
  80.     }
  81.  
  82. void close_all()
  83.     {
  84.         if(WorldWideBase) CloseLibrary(WorldWideBase);
  85.         exit(RETURN_OK);
  86.     }
  87.